home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / win / golfiery.zip / READ.ME < prev   
Text File  |  1995-04-03  |  31KB  |  776 lines

  1. READ.ME
  2. =======
  3.  
  4. The DLL in this archive (GOLFIERY.DLL) implements functions for tooltip-like
  5. windows and balloon help. Golfiery and its demos and demo-sources are 
  6. freeware. Golfiery is copyrighted software, but you're free to distribute
  7. it with your applications. Read the "about the use of this software" section
  8. for more details.
  9.  
  10. If this text file looks odd, don't worry. I'm also working on a Windows help 
  11. file with a Golfiery API reference. Till that time you have to do it with
  12. the source code of the demos and this read.me file.
  13.  
  14. Don't mind my English too.
  15.  
  16. There are several sections/paragraphs in this text file:
  17.  
  18. - What's balloon help
  19. - GOLFIERY.DLL & files
  20. - demos
  21. - description of the Golfiery functions
  22. - shortcomings
  23. - about the author
  24. - about the use of this software
  25.  
  26.  
  27. What's balloon help
  28. ===================
  29.  
  30. I don't hope "balloon help" is trademarked. "ToolTips" _is_. Golfiery provides
  31. several functions for creating tooltip and balloonhelp windows. 
  32. In Golfiery's lingo tooltips are FlyByHints. FlyByHints give a brief
  33. description (hint) of a button's (or any other screen part's) purpose. They're 
  34. a much handier than hint texts in statusbars. FlyByHints float above or 
  35. somewhere in the neighbourhood of a screen part.
  36.  
  37. BalloonHelp is another useful help window. I believe the MacOS had these things
  38. first (correct me if I'm wrong). The term BalloonHelp refers to the balloons
  39. in comics. Comic characters "talk" with balloons. In GUI environments, balloons 
  40. have the same purpose: they let screen parts of your applications talk.
  41.  
  42. As opposed to tooltips, BalloonHelp windows often have a title and a 
  43. multi-line text. A balloon often points at the screen part that needs be 
  44. explained. FlyByHints and Balloons also differ in behaviour: FlyByHints 
  45. provide "hints", Balloons "explain"; FlyByHints are what I call 
  46. volatile: they appear for a short time on-screen, if you move out of the 
  47. area of the hinted screen part, the FlyByHint should "disappear". A balloon 
  48. disappears whenever the user performs a keyboard or mouse action (typing or 
  49. clicking).
  50.  
  51.  
  52. GOLFIERY.DLL & files
  53. ====================
  54.  
  55. The Golfiery DLL provides about ten functions. Four of these functions are 
  56. for ToolTips (FlyByHints), the other functions are for BalloonHelp. The DLL
  57. is rather small so it won't take up a lot of your hard drive's space. The 
  58. DLL should be installed in the Windows system directory.
  59.  
  60. There are several files within the golfiery package, the most important are:
  61.  
  62. GOLFIERY.DLL  - The golfiery DLL
  63. GOLFIERY.H    - Golfiery include file for C/C++
  64. GOLFIERY.LIB  - Import library. You can create your own import lib by
  65.                 using implib.exe on GOLFIERY.DLL (implib.exe is supplied
  66.                 by all Windows C/C++ compiler vendors)
  67. GOLFIERY.BAS  - Basic file with definitions
  68. READ.ME       - this file
  69.  
  70.  
  71. Demos
  72. =====
  73.  
  74. Currently this archive contains three programming examples:
  75.  
  76. - tooltips.exe + sources. Demonstrates how to use the FlyByHint functions
  77. in a regular C program.
  78. - balloon.exe + sources. Demonstrates some balloon help functions. In C.
  79. - balloonh.bas and balloonh.frm. A Visual basic demo. You won't find
  80. a compiled example, only sources. The Visual Basic demo has been written
  81. by Erik Baas and demonstrates how to use some of the FlyByHint functions, 
  82. and the special VB functions of Golfiery.
  83.  
  84. Both C samples show how to superclass the flyby hint and balloonhelp classes.
  85. If you have a Golfiery demo written in any other language, please feel free
  86. to submit the source code and/or necessary headers. Especially code samples
  87. for Delphi are welcome. I've done a lot programming wit Pascal OWL, but
  88. Delphi is far too difficult for me. 
  89.  
  90.  
  91. Description of the GOLFIERY functions
  92. =====================================
  93.  
  94. FlyByHints/ToolTips
  95. -------------------
  96.  
  97. The FlyByHints are the most "difficult" windows to program *with*. Remember: 
  98. the FlyByHints are displayed whenever the mouse cursor is above a screen part
  99. that needs to be hinted. In plain programmer's words: your programming
  100. environment should allow you to trap MouseMove events. So insert a call to
  101. a flyby hint function in your WM_MOUSEMOVE code. The FlyByHint windows
  102. auto-destruct themselves, you don't have to do anything else (Golfiery handles
  103. a lot for you). There's one thing the FlyByHint functions can't do: detect 
  104. that a flyby hint must appear when the user has not touched the keyboard for 
  105. a while and the mouse cursor hasn't been moved. Luckily most application 
  106. frameworks have a special function that is called whenever an application 
  107. is idle (doing nothing). Perhaps you should insert a call to FlyByHint inside 
  108. this idle function too. (Visual Basic programmers could use a timer and the 
  109. Win API function GetCursorPos. If the mouse hasn't moved for a while the 
  110. timer function could decide to call a FlyByHint function)
  111.  
  112. In all other cases FlyByHint is fairly intelligent. I call the FlyByHint 
  113. asynchroneously: it can be called many times (esp. within a mouse move 
  114. event), but a flyby hint will only appear if certain conditions are met 
  115. (no other flyby hint on-screen, mousemove message generated by an 
  116. inactive window etc). The advantage of this approach is that you supply the
  117. parameters and Golfiery decides whether the conditions are met. 
  118.  
  119.  
  120. The FlyByHint functions
  121. -----------------------
  122.  
  123. -+++- FlyByHint -+++-
  124.  
  125. BOOL WINAPI FlyByHint (HWND hwndFrame, LPRECT rcRect, LPCSTR szHintText);
  126. Declare Sub FlyByHint Lib "golfiery.dll" (ByVal hwndFrame%, rcRect As Rect, ByVal szHintText$)
  127.  
  128. Parameters
  129.  
  130. hwndFrame - The FlyByHint behaves like a popup window, like a little dialog.
  131.   Imagine the hwndFrame as the window that deactivates when a normal 
  132.   modeless dialog is about to be displayed. Mostly the hwndFrame is the
  133.   parent of the FlyByHint, but there are some exceptions.
  134.   When the flyby hint is used within a MDI parent's toolbar, then the
  135.   MDI parent form/window is the hwndFrame. When FlyByHint is used within
  136.   an MDI child form/window, then the MDI parent form/window is the 
  137.   hwndFrame too (because the MDI *parent* becomes inactive). However when the 
  138.   FlyByHint is used within a modal dialog, the *modal dialog* is the hwndFrame.
  139.   
  140.   The hwndFrame parameter should be compared with the hParent parameter in
  141.   the MessageBox API function. There's only one exception: hwndFrame _can't_
  142.   be the desktop window.
  143.  
  144. rcRect - is a pointer to the rectangular area (in screen coordinates) for which 
  145.   a FlyByHint should appear. When a FlyByHint should appear for a window the 
  146.   FlyByHintFromWindow function is the obvious choice. However, mostly tool 
  147.   bar buttons are not windows at all, instead they're drawn by some tool bar 
  148.   parent window. If this is the case calculate the area yourself using the 
  149.   Windows API function GetWindowRect and the RECT structure. For Visual Basic 
  150.   programmers: this function and RECT are defined in GOLFIERY.BAS.
  151.  
  152. szHintText - The hint text that should appear in the flyby hint.
  153.  
  154.  
  155. Result
  156.  
  157. Actually all Golfiery functions return the HWND of the created window. When the
  158. function returns and a Golfiery window (tooltip or balloon) has been created , 
  159. the window associated with the HWND might be destroyed. So the result value 
  160. could be used as "success test", but it doesn't do any harm if you neglect 
  161. the return value.
  162.  
  163.  
  164. Basic example
  165.  
  166. Sub Form_MouseMove (Button As Integer, Shift As Integer, X As Single, Y As Single)
  167.   ' For controls without a hWnd property or MouseMove event:
  168.   Dim P As Rect, PA As PointApi, r%
  169.   
  170.   PA.X = X
  171.   PA.Y = Y
  172.  
  173.   ' Windows API function
  174.   ClientToScreen hWnd, PA
  175.  
  176.   ' Function in BALLOONH.BAS
  177.   GetControlRect Shape1, P
  178.   If PA.X >= P.Left And PA.X < P.Right And PA.Y >= P.Top And PA.Y < P.Bottom Then
  179.     VBFlyByHint Form1.hWnd, Shape1, "VBFlyByHint: Shape1"
  180.   End If
  181. End Sub
  182.  
  183.  
  184. C example
  185.  
  186. /*** rcManagedArea is the RECT of an area painted by hDlg ***/
  187. case WM_MOUSEMOVE:
  188.   if (_fToolTip)
  189.     if (PtInRect(&rcManagedArea, *((LPPOINT)&lParam))) {
  190.       RECT  rcWindow;
  191.  
  192.       rcWindow = rcManagedArea;
  193.       /*** Convert it from client area to screen coordinates ***/
  194.       MapWindowPoints(hDlg, 0, (LPPOINT)&rcWindow, 2);
  195.       FlyByHint (_hwndMain, &rcWindow, painttext);
  196.     }
  197.     break;
  198. -+++-           -+++- 
  199.  
  200. -+++- FlyByHintFromWindow -+++-
  201.  
  202. BOOL WINAPI FlyByHintFromWindow (HWND hwndFrame, HWND hwndHintAbout, LPCSTR szString);
  203. Declare Sub FlyByHintFromWindow Lib "golfiery.dll" (ByVal hwndFrame%, ByVal hwndHintAbout%, ByVal szString$)
  204.  
  205. Parameters
  206.  
  207. hwndFrame - The notorious frame window handle. See FlyByHint for a description.
  208. hwndHintAbout - The window handle of the window that needs to be described by
  209.   a flyby hint
  210. szString - The hint text
  211.  
  212.  
  213. Basic example
  214.  
  215. Sub Command1_MouseMove (Button As Integer, Shift As Integer, X As Single, Y As Single)
  216.   ' For Controls with a hWnd property:
  217.   FlyByHintFromWindow Form1.hWnd, Command1.hWnd, "Command button 1"
  218. End Sub
  219.  
  220.  
  221. C example
  222.  
  223. if (uMsg == WM_MOUSEMOVE)
  224.   if (_fToolTip) {
  225.     LoadString(_hInst, IDS_TEXT_HELP + id, (LPSTR)&buf, sizeof buf);
  226.     FlyByHintFromWindow(_hwndMain, hChild, buf);
  227.   }
  228. -+++-                     -+++-
  229.  
  230. -+++- FlyByHintFromClass -+++-
  231.  
  232. BOOL WINAPI FlyByHintFromClass (HINSTANCE hInst, LPCSTR lpszClassName, HWND hwndFrame, LPRECT rcRect, LPCSTR szString);
  233.  
  234. Parameters 
  235.  
  236. hInst - The program instance that defined a new FlyByHint class
  237. lpszClassName - The name of the new class. The old class' name is defined as
  238.   #define FLYBYHINTCLASSNAME "Ahii_FlyByToolTip"
  239. hwndFrame - see FlyByHint
  240. rcRect - same as in FlyByHint. The area that needs to be hinted.
  241. szString - The hint text
  242.  
  243.  
  244. Description
  245.  
  246. This function can only be used by programming languages that allow superclassing.
  247. Superclassing is a Windows programming technique that allows the programmer
  248. to build upon predefined Windows classes. If Golfiery has been loaded, the
  249. FlyByHint is a predefined class too. If you want to know how superclassing
  250. works in C, refer to the tooltips.c demo file. Superclassing is also possible
  251. with C++ Frameworks (MFC and OWL do superclassing behind the scenes).
  252.  
  253. There are several messages that should always be passed to old class' procedure: 
  254.  
  255. WM_CREATE
  256. WM_DESTROY
  257. WM_ERASEBKGND - Returns 1 indicating the FlyByHint class erased background
  258. WM_PAINT - By default the WM_PAINT handling code queries the used font 
  259.   by sending WM_GETFONT and WM_CTLCOLOR messages.
  260.  
  261. These messages may be intercepted by your class:
  262.  
  263. WM_GETFONT - By default the FlyByHint class returns the Ansi variable pitch
  264.   system font. You could return a handle of a different (previously created) 
  265.   font. Golfiery doesn't destroy fonts that it doesn't own. If you allocated
  266.   a font for your superclass, you're responsible for destroying the font
  267.   (this makes sense in GUI programming).
  268.  
  269. WM_CTLCOLOR - If HIWORD(lParam) == CTLCOLOR_DLG the FlyByHint class returns
  270.   the class background brush. This brush is used in the WM_PAINT code. If you
  271.   want to change the back ground brush, return a different handle or change
  272.   your superclass' brush. This message is also ideal for changing the 
  273.   color of text. The wParam contains the handle of the device context used 
  274.   by the WM_PAINT code. (Read the SDK for more info about WM_CTLCOLOR).
  275.  
  276. Read the "Superclassing the BalloonHelp" section for more info on superclassing.
  277. -+++-                    -+++-
  278.  
  279. -+++- VBFlyByHint -+++-
  280.  
  281. Declare Sub VBFlyByHint Lib "golfiery.dll" (ByVal hwndFrame%, VBObject As Any, ByVal szString$)
  282.  
  283. Parameters
  284.  
  285. hwndFrame% - See FlyByHint.
  286. VBObject - The name of the Visual Basic object that will be hinted. 
  287. szString$ - The hint text
  288.  
  289.  
  290. Description
  291.  
  292. This function is for Visual Basic programmers only. VBObject is the Control
  293. name of a Visual Basic control.
  294.  
  295. This function will *probably* fail if you are using Visual basic version 1. 
  296. Visual Basic programmers should use this function whenever possible. 
  297. -+++-             -+++-
  298.  
  299.  
  300. The BalloonHelp functions
  301. -------------------------
  302.  
  303. The balloon help functions are far more easier to use. You don't need to 
  304. handle these function within an event handler. Just call them.
  305.  
  306. There are two special functions for Visual Basic.
  307.  
  308. -+++- BalloonHelp -+++-
  309.  
  310. BOOL WINAPI BalloonHelp (HWND hwndFrame, LPRECT rcArea, LPCSTR szTitle, LPCSTR szText);
  311. Declare Sub BalloonHelp Lib "golfiery.dll" (ByVal hwndFrame%, rcArea As Rect, ByVal szTitle$, ByVal szText$)
  312.  
  313. Parameters
  314.  
  315. hwndFrame - The frame window that becomes inactive. See the description of
  316.   FlyByHint.
  317. rcArea - The (window) area that needs to be explained by a balloon help text
  318. szTitle - The title of the balloon help window. By default bold face ANSI
  319.   variable pitched system font. Might be NULL or empty.
  320. szText - The help text. By default it appears in a the ANSI variable pitched
  321.   system font. Might be NULL or empty.
  322. -+++-             -+++-  
  323.  
  324. -+++- BalloonHelpEx -+++-
  325.  
  326. BOOL WINAPI BalloonHelpEx (HWND hwndFrame, LPRECT rcArea, LPCSTR szTitle, LPCSTR szText, WORD wStyle);
  327. Declare Sub BalloonHelpEx Lib "golfiery.dll" (ByVal hwndFrame%, rcArea As Rect, ByVal szTitle$, ByVal szText$, ByVal wStyle%)
  328.  
  329. Parameters
  330.  
  331. All parameters are the same as in BalloonHelp.
  332. wStyle - A style for the BalloonHelp window.
  333.  
  334.  
  335. Description
  336.  
  337. BalloonHelpEx is the extended version of BalloonHelp. Use the wStyle
  338. parameter to "modify" the appearance of a balloon help window. 
  339. If you want to use more than one style use the "OR"-operator (in C: |, in
  340. Basic: or, in Pascal: or) to combine them. Refer to balloon.c and 
  341. balloon.exe for a demonstration of the BalloonHelp styles.
  342.  
  343. BLNS_DEFAULT (0) - The default window style. The balloon has a tag and will
  344.   position itself.
  345.  
  346. BLNS_LEFTTOP (1), 
  347. BLNS_RIGHTTOP (2),
  348. BLNS_RIGHTBOTTOM (3), 
  349. BLNS_LEFTBOTTOM (4) - Use one of this styles to specify the position of
  350.   the balloon tag (pointer)
  351.  
  352. BLNS_THINBORDER (0x10, &H10) - Draws a thin border around the balloon (instead
  353.   of a thick anti-alias-like border)
  354.  
  355. BLNS_BALLOONATPOINT (0x20, &H20) - Places the balloontag position at the 
  356.   rcArea.left and rcArea.top position. The rcArea.right and rcArea.bottom
  357.   fields are ignored. Can be combined with one of the tag position styles.
  358.   If the tag position style is BLNS_DEFAULT, the tag position will be
  359.   calculated by the balloon window.
  360.  
  361. BLNS_NOTAG (0x40, &H40) - Does not draw the tag/pointer of the balloon. It's
  362.   still possible to position the balloon with BLNS_BALLOONATPOINT and one of 
  363.   the tag position styles. With this style on the tag is virtualized ;-).
  364.  
  365. Visual Basic programmers should look at the VBBalloonHelpEx function.
  366.  
  367.  
  368. C example
  369.  
  370.   case WM_LBUTTONDOWN:
  371.     RECT rcWindow;
  372.  
  373.     GetWindowRect(hWnd, &rcWindow);
  374.     BalloonHelpEx(hWndFrame, &rcWindow, "Title", "This is the balloon text",
  375.       BLNS_DEFAULT | BLNS_NOTAG | BLNS_THINBORDER);
  376.     break;
  377.  
  378. or another example, with BLNS_BALLOONATPOINT:
  379.  
  380.   case WM_LBUTTONDOWN:
  381.     RECT rcWindow;
  382.  
  383.     /*** Could use the lParam :-). Get the current cursor position ***/
  384.     GetCursorPos((LPPOINT)&rcWindow);
  385.  
  386.     /*** Use a tag at the right bottom corner of the balloon ***/
  387.     BalloonHelpEx(hWndFrame, &rcWindow, "Some Title", "This is a text",
  388.       BLNS_RIGHTBOTTOM | BLNS_BALLOONATPOINT);
  389.     break;
  390. -+++-               -+++-  
  391.  
  392. -+++- BalloonHelpFromWindow -+++-
  393.  
  394. BOOL WINAPI BalloonHelpFromWindow (HWND hwndFrame, HWND hwndInfoAbout, LPCSTR szTitle, LPCSTR szText);
  395. Declare Sub BalloonHelpFromWindow Lib "golfiery.dll" (ByVal hwndFrame%, ByVal hWndInfoAbout%, ByVal szTitle$, ByVal szText$)
  396.  
  397.  
  398. Parameters
  399.  
  400. hwndFrame, szTitle, szText - see BalloonHelp
  401. hwndInfoAbout - The handle of the window that needs to be BalloonHelp-ed.
  402.  
  403.  
  404. C example
  405.  
  406.   case WM_LBUTTONDOWN:
  407.     BalloonHelpFromWindow(hwndFrame, hWndThisWindow, "Title", "This is a text");
  408.     break;
  409. -+++-                       -+++-
  410.  
  411. -+++- VBBalloonHelp -+++-
  412.  
  413. Declare Sub VBBalloonHelp Lib "golfiery.dll" (ByVal hwndFrame%, VBObject As Any, ByVal szTitle$, ByVal szText$)
  414.  
  415. This is a special function for VB programmers. All the parameters (except for 
  416. VBObject) are the same as for BalloonHelp. VBObject is the name of the
  417. Visual Basic control that needs balloonhelp.
  418. -+++-               -+++-
  419.  
  420. -+++- VBBalloonHelpEx -+++-
  421.  
  422. Declare Sub VBBalloonHelpEx Lib "golfiery.dll" (ByVal hwndFrame%, VBObject As Any, ByVal szTitle$, ByVal szText$, ByVal wStyle%)
  423.  
  424. Except for the VBObject parameter all parameters are the same as in
  425. BalloonHelpEx. VBObject is the control name of a Visual Basic control.
  426. -+++-                 -+++-
  427.  
  428.  
  429. -+++- BalloonHelpFromClass -+++-
  430.  
  431. BOOL WINAPI BalloonHelpFromClass (HINSTANCE hInst, LPCSTR lpszClassName, HWND hwndFrame, LPRECT lprcArea, LPCSTR lpszTitle, LPCSTR lpszText, WORD wStyle);
  432.  
  433.  
  434. Parameters
  435.  
  436. hInst - The instance handle of the application or DLL in which the new
  437.   superclass had been defined by a call to RegisterClass.
  438. lpszClassName - The name of the class to be used as balloon help.
  439.  
  440. All other parameters should be obvious by now.
  441.  
  442.  
  443. Description
  444.  
  445. Refer to the next section for a in-depth description of superclassing. It 
  446. is possible to use your own window classes (not "inheriting" from
  447. Golfiery's BalloonHelp class) as "BalloonHelp". Perhaps you want to use
  448. one of your dialogs as a sort of balloon. Contact the author for more 
  449. information.
  450. -+++-                      -+++-
  451.  
  452.  
  453. Superclassing the balloon help
  454. ------------------------------
  455.  
  456. Golfiery has a special BalloonHelp function for programmers who want to 
  457. alter the behaviour of the BalloonHelp window. The demo program BALLOON.EXE
  458. (it's source is BALLOON.C) shows an (IMHO: ugly) example of a superclassed 
  459. balloon help. This section describes how superclassing in C works. In C++ 
  460. you can create your own C++ class wrapper (perhaps by inheriting from TWindow 
  461. or CWindow).
  462.  
  463. For superclassing you first need the instance handle of the Golfiery DLL and
  464. the classname of Golfiery's balloon help window. The classname of Golfiery's 
  465. balloon help window is defined in GOLFIERY.H:
  466.  
  467. #define BALLOONCLASSNAME "Ahii_Balloon"
  468.  
  469. The instance handle of the Golfiery DLL can be retrieved with the following
  470. code snippet:
  471.  
  472.   WNDCLASS    wndclass;
  473.   HINSTANCE   hInstGolfiery;
  474.  
  475.   /*** Get instance handle of the balloon dll ***/
  476.   hInstGolfiery = LoadLibrary("golfiery.dll");
  477.   FreeLibrary(hInstGolfiery);
  478.  
  479.   /*** Retrieve info about the balloonhelp class ***/
  480.   if ( !GetClassInfo(hInstGolfiery, BALLOONCLASSNAME, &wndclass) )
  481.     return FALSE;
  482.  
  483. There's one *CATCH* to this approach. This piece of code assumes that Golfiery
  484. is already loaded implicitly by your program (i.e. your program imports
  485. the golfiery functions). If this is not the case (your application loads
  486. golfiery with a LoadLibrary and is importing the Golfiery functions with
  487. calls to the GetProcAddress API), move the FreeLibrary call to the 
  488. termination code of your program.
  489.  
  490. If all's well, wndclass contains the class information of the BalloonHelp
  491. window class. Now we need to clear the CS_GLOBALCLASS bit (if you're
  492. defining the new class inside a DLL, you should let this bit *ON*), store
  493. the old class' procedure and replace the wndclass.lpfnWndProc member 
  494. with the address of the superclass procedure, set the instance handle of 
  495. the application or DLL that defines the new class, change the background brush 
  496. (optional) and assign a new name to the class. Here some code:
  497.  
  498.   /*** Superclass class won't be global, clear bit ***/
  499.   wndclass.style &= ~CS_GLOBALCLASS;
  500.  
  501.   /*** New class will be valid for this instance only ***/
  502.   _lpfnOldProc = wndclass.lpfnWndProc;
  503.   wndclass.lpfnWndProc = NewBalloonWndProc;
  504.   wndclass.hInstance = _hInst;
  505.   wndclass.hbrBackground = CreateSolidBrush(RGB(192, 192, 192)) ;
  506.   wndclass.lpszClassName = (LPCSTR)NEWBALLOONCLASSNAME;
  507.  
  508. Now you can register your superclass with the RegisterClass API function.
  509.  
  510. The superclass should pass most messages to the old class' procedure.
  511. However there are messages which might be interesting to intercept:
  512.  
  513. -+++- BLNM_GETTITLEFONT (WM_USER + 1) -+++-
  514.  
  515. BLNM_GETTITLEFONT               (golfiery.h)
  516.  
  517. wParam = 0; /* not used */
  518. lParam = 0; /* not used */
  519.  
  520. Sent during the handling of WM_CREATE and WM_PAINT this message returns
  521. the font for the balloon help title. By default this message returns the 
  522. bold faced ANSI variable pitched system font. Your superclass should 
  523. intercept this message if it wiil be using another font. You do not have 
  524. to call the old class procedure.
  525.  
  526. The width and height of the new font should be specified in device 
  527. coordinates (pixels).
  528. -+++-                                 -+++-
  529.  
  530. -+++- BLNM_GETTEXTFONT (WM_USER + 3) -+++- 
  531.  
  532. BLNM_GETTEXTFONT                (golfiery.h)
  533.  
  534. wParam = 0; /* not used */
  535. lParam = 0; /* not used */
  536.  
  537. Analog to BLNM_GETTITLEFONT. Sent during WM_CREATE and WM_PAINT. Returns
  538. the font for the help text in the balloon. Intercept this message if
  539. you want your superclass to use a different font (the default font is
  540. the ANSI variable pitched system font). If you intercept this message
  541. it's not necessary to call the old class procedure.
  542.  
  543. The created font must have a width and height specified in device coordinates
  544. (pixels).
  545.  
  546. NOTE: This message is "mapped" to WM_GETFONT. You can intercept WM_GETFONT
  547. or BLNM_GETTEXTFONT. Intercepting both won't do any harm, but is "overkill".
  548. -+++-                                -+++-
  549.  
  550. -+++- BLNM_SETBALLOONDIM (WM_USER + 4) -+++-
  551.  
  552. BLNM_SETBALLOONDIM              (golfiery.h)
  553.  
  554. wParam = 0; /* not used */
  555. lpbd = (LPBLNDIM)lParam; /* pointer to a BLNDIM struct */
  556.  
  557. typedef struct {
  558.    int   nX;               /*** position and dimension ***/
  559.    int   nY;
  560.    int   nCx;
  561.    int   nCy;
  562.    int   nTextWidth;       /*** width of text body ***/
  563.    int   nTextHeight;      /*** height of text body ***/
  564.    int   nSeparator;       /*** distance between text and title ***/
  565.    int   nTitleHeight;     /*** height of title ***/
  566.    int   nRRWidth;         /*** Rectangle rounded corners based on used fonts ***/
  567.    int   nRRHeight;
  568. } BLNDIM, FAR* LPBLNDIM, NEAR* NPBLNDIM, * PBLNDIM;
  569.  
  570. This message is sent *once* and only during the handling of the WM_CREATE
  571. message. After the WM_CREATE code determines the dimensions of the text
  572. it calculates the correct values for each of the members in the BLNDIM
  573. struct. By sending BLNM_SETBALLOONDIM the structure values are stored in an 
  574. internal datastructure (allocated in the DLL's local heap). You're allowed 
  575. to change the struct's field values before passing the message to the 
  576. old procedure class. Remember: the old procedure class *must* be called
  577. *after* you've changed structure members. If you call the old class' 
  578. procedure first, the changes won't have any effect.
  579.  
  580. Keep in mind that Golfiery's balloon help is resolution independent. To 
  581. achieve this Golfiery sets the nRRWidth and nRRHeight fields to the character width 
  582. and height of the text font. And because the text font and title font are based
  583. on the ANSI variable pitched font (ANSI_VAR_FONT), the standard balloon will
  584. be visible (and readable) on all displays.
  585. -+++-                                  -+++-
  586.  
  587. -+++- BLNM_GETBALLOONDIM (WM_USER + 5) -+++-
  588.  
  589. BLNM_GETBALLOONDIM
  590.  
  591. wParam = 0; /* not used */
  592. lpbd = (LPBLNDIM)lParam; /* pointer to a BLNDIM struct that receives 
  593.                             dimension info of a balloon */
  594.  
  595. This message should *not* be intercepted by the superclass. Also this message
  596. should not be sent to a BalloonHelp window created with one of Golfiery's 
  597. BalloonHelp function. At the time a BalloonHelp function returns, the
  598. BalloonHelp window's handle might be invalid.
  599.  
  600. What's the purpose of this message? Well, it can be send within in your super
  601. class. The lParam is a far pointer to a BLNDIM structure. This structure 
  602. will contain the dimension/position values of a balloon.
  603.  
  604. This message is sent by Golfiery's internal IntBalloonHelp function which 
  605. is in its turn is called by all xxxBalloonHelpxxx functions. With this 
  606. message the IntBalloonhelp function retrieves the dimension data of a 
  607. balloon; the balloon is positioned and sized with a call to the MoveWindow 
  608. API function.
  609. -+++-                                  -+++-
  610.  
  611. -+++- WM_CTLCOLOR (standard Windows message) -+++-
  612.  
  613. WM_CTLCOLOR
  614.  
  615. hdc = (HDC)wParam;      /** the dc for the WM_PAINT code **/
  616. hwnd = (HWND)LOWORD(lParam);  /** hwnd of balloon **/
  617. nType = (int)HIWORD(lParam);  /** type of paint action **/
  618.  
  619. During the handling of the WM_PAINT code, the balloon sends several
  620. WM_CTLCOLOR messages to *itself*. By intercepting these messages you can
  621. control the paint process of the balloon window.
  622.  
  623. The Balloon window sends three types of WM_CTLCOLOR messages
  624.  
  625.  
  626. nType == CTLCOLOR_DLG   (standard Windows type)
  627.  
  628. if nType is CTLCOLOR_DLG the WM_PAINT code requests the background brush
  629. for the balloon. By default the class procedure returns the class' background 
  630. brush (of the wndclass.hbrBackground field). This brush is used for painting
  631. the background of the balloon.
  632.  
  633.  
  634. nType == CTLCOLOR_TITLEFONT (50, see golfiery.h)
  635.  
  636. if nType is CTLCOLOR_TITLEFONT the WM_PAINT code gives the superclass the
  637. chance to alter the attributes of the paint device context (sent through the 
  638. wParam). Use this message type to alter the text color, text back mode or 
  639. text backcolor of the title text.
  640.  
  641.  
  642. nType == CTLCOLOR_TEXTFONT  (CTLCOLOR_TITLEFONT + 1, see golfiery.h)
  643.  
  644. if nType is CTLCOLOR_TEXTFONT the WM_PAINT code allows the super class to
  645. alter the attributes of the paint device context (sent through the wParam).
  646. Use this message to alter the text color, text back mode or text backcolor
  647. ot the help text.
  648.  
  649. In all three cases the class procedure returns the background brush. 
  650. -+++-                                        -+++-
  651.  
  652.  
  653. Known shortcomings
  654. ==================
  655.  
  656. Perhaps there are some shortcomings in this demo version, if you've found one
  657. please let me know
  658.  
  659.  
  660. Enhancements
  661. ============
  662.  
  663. March 5/6, 1995 - Special enhancements for the superclassers. The flyby hint
  664. sends WM_CTLCOLOR (CTLCOLOR_DLG) to retrieve the hBrush for the tooltip.
  665.  
  666. March/April, 1995 - Added real balloonhelp. Fixed word wrapping bug.
  667.  
  668. Future/planned enhancements:
  669.  
  670. - icons/bitmaps inside title and text (not within three months, I'm already
  671. busy with another project :-)
  672. - owner drawing
  673. - passing more variables (font handles etc).
  674. - The FlyByHint pause. No it's not a hardcoded value.
  675.  
  676. (No, I won't write a VBX... Well, perhaps you can persuade me.)
  677.  
  678.  
  679. About the author
  680. ----------------
  681.  
  682. Alfons Hoogervorst occasionally contributes to several Fidonet echo areas
  683. (including WINDOWS.PROG, C_ECHO and PASCAL). He has been programming Windows
  684. for about four years. He works as a freelance translator.
  685.  
  686. He is also the author of "MyStory Not His", a program history utility for 
  687. Windows 3.1x. Alfons specializes in low-level Windows programming and
  688. custom controls. He's affluent in languages like C, C++ and Pascal (and a
  689. couple of other languages). Alfons is also a fan of Andrew Schulman (perhaps
  690. someone can send him an autographed "Undocumented Windows"? ;-). Furthermore 
  691. he seems to have an obscure obssession for inventing puns for his programming 
  692. projects (Golfiery was also known as Ballunatic, MyStory as Maestory).
  693.  
  694. Currently Alfons works on a special VBX-project nicknamed 
  695. "think-thought-thunk".
  696.  
  697. Alfons can be reached by Fido mail 2:500/121.6252 at The C Programmers 
  698. Board (aka DOSBoss West). The C Programmers Board's phone number is 
  699. 31-020-6124530. 8 databits, no parity, 1 stopbit. Try V42 or V32bis, 
  700. connection speed max. 14K4 (in the Netherlands ofcourse). 
  701.  
  702. Fido      2:500/121.6252
  703. Internet  a.hoogervorst@dosgg.nl
  704.  
  705. Alternatively try ahoogerv@knoware.nl
  706.  
  707.  
  708. Acknowledgments
  709. ---------------
  710.  
  711. Arthur Hoogervorst
  712. Erik Baas (DOSBoss West user)
  713. Rob de Voer
  714. Fabio Cereda Cordiero
  715. Alex Stienstra (sysop of DOSBoss West)
  716.  
  717. The DOSBoss West users and points for allowing yet another programmer
  718. The WINDOWS.PROG contributers (hey! Don't have any access to WINDOWS.PROG,
  719. don't know why)
  720.  
  721.  
  722. About the use of this software
  723. ------------------------------
  724.  
  725. [I found this piece of legal stuff somewhere]
  726.  
  727. I do not promise that this software works. If you happen to find any bugs, 
  728. please let me know. You're allowed to use this software for whatever you want.
  729.  
  730. Give credits to the person who created this nice piece of software (add my
  731. name to your credits to spiff up your applications :-) In other words, 
  732. I *won't* mind my name not appearing in your program's documentation, but
  733. I'd really appreciate it if you add one of the following lines in your 
  734. program's copyright notice, documentation or credits:
  735.  
  736. "Golfiery (c) 1995 by Alfons Hoogervorst"
  737. "Golfiery has been written by Alfons Hoogervorst"
  738.  
  739.  
  740. More legal terms:
  741.  
  742. The author nor any of the above (or in the software) mentioned persons or 
  743. companies make NO WARRANTY, either express or implied, regarding the 
  744. quality or fitness of this software for a particular purpose. This software 
  745. is provided on an "AS IS" basis, it's the user who assumes the entire risk as 
  746. to its quality and fitness.
  747.  
  748. This software is copyright (C) 1995 Alfons Hoogervorst
  749.  
  750. Permission is hereby granted to use, copy, modify, and distribute this
  751. software (or portions thereof) for any purpose, *without fee*, subject to 
  752. these conditions:
  753.  
  754. 1. If any part of the source code for this software is distributed, then this 
  755. file must be included, with this copyright and no-warranty notice unaltered; 
  756. and any additions, deletions, or *changes* to the original files must be 
  757. clearly indicated in accompanying documentation.
  758.  
  759. 2. Permission for use of this software is granted only if the user accepts 
  760. full responsibility for any undesirable consequences; the author nor any of 
  761. the aforementioned persons or companies can be held responsible or liable for 
  762. damages of any kind resulting from incorrect/improper working of the descibed 
  763. software.
  764.  
  765. The author specifically permits and encourages the use of this software in 
  766. commercial products, provided that all warranty or liability claims are 
  767. assumed by the product vendor.
  768.  
  769. =============================================================================
  770. Perhaps I mentioned some registered trademarks (not that I know of). In that 
  771. case:
  772.  
  773. Some words or "phrases" in this text file could be/happen to be registered 
  774. trademarks of their respective holders.
  775. =============================================================================
  776.